package com.xinlu.common.game.bo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.xinlu.common.game.dao.WcZjxxDao;
import com.xinlu.common.game.value.WcZjxxVo;
import com.xinlu.derek.common.BaseBo;
import com.xinlu.persistence.WcZjxx;
import com.xinlu.util.tool.DateUtil;

public class WcZjxxBo extends BaseBo{
	
	/************  Dao 注入 Start **************/
	private WcZjxxDao wcZjxxDao;
	
	public void setWcZjxxDao(WcZjxxDao wcZjxxDao) {
		this.wcZjxxDao = wcZjxxDao;
	}
	/************  Dao 注入 End **************/


	/**
	 * 
	 * Function :		获取当前的开奖信息
	 * @param yxlx		游戏模式
	 * @return
	 * Derek
	 * 2011-5-31 上午12:48:34
	 */
	public List<WcZjxxVo> getAllZjxxList(String yxlx){
		
		if ("CQSSC".equals(yxlx)) {
			
			yxlx = "重庆时时彩";
		}else if ("JXSSC".equals(yxlx)) {
			
			yxlx = "江西时时彩";
			
		}else if ("HLJSSC".equals(yxlx)) {
			
			yxlx = "黑龙江时时彩";
		}
		
		Date today = DateUtil.getDate(DateUtil.YYYYMMDD, DateUtil.getFormatDate(DateUtil.YYYYMMDD, DateUtil.getCurrentdate()));
		
		List<WcZjxx> list = this.wcZjxxDao.getAllZjxxList(today, yxlx);
		
		List<WcZjxxVo> voList = null;
		
		if (list != null && list.size() > 0) {
			
			WcZjxx po = null;
			WcZjxxVo vo = null;
			voList = new ArrayList<WcZjxxVo>();
			
			for (int i = 0; i < list.size(); i++) {
				
				po = list.get(i);
				vo = new WcZjxxVo();
				
				vo.setKjsj(DateUtil.getFormatDate(DateUtil.YYYY_MM_DD_HH_MI_SS, po.getKjsj()));
				vo.setKjhm(po.getKjhm1() + " " + po.getKjhm2() + " " + po.getKjhm3() + " " + po.getKjhm4() + " " + po.getKjhm5());
				vo.setQs(po.getQh());
				
				voList.add(vo);
			}
		}
		
		return voList;
	}
	
	
	
}
